<template>
  <div class="container">
    <div class="box box-ver h-p100">
      <div class="box-f1 of-y-s">
        <div class="total">
          <div>您本次的交通报销金额合计为</div>
          <div class="box box-ac amount">
            <div>¥&nbsp;</div>
            <input v-model="total" v-limit-money readonly class="box-f1" type="number">
          </div>
        </div>
        <div class="list">
          <div class="item box box-ver">
            <div>往返机场/车站金额</div>
            <div class="box box-ac amount">
              <div>¥&nbsp;</div>
              <input v-auto-scroll v-model="person.CFGOBACKFLY" v-limit-money class="box-f1"  type="number">
            </div>
            <div class="tips box">
              <div class="icon icon-invoice-tips"></div>
              <div class="tc-666 box-f1">
                往返机场或火车站路程所产生的出租车或快车等费用
              </div>
            </div>
          </div>
          <div class="item box box-ver">
            <div>机票/火车票/自驾费用</div>
            <div class="box box-ac amount">
              <div>¥&nbsp;</div>
              <input v-auto-scroll class="box-f1" v-limit-money v-model="person.BUSSESEXPENSE" type="number">
            </div>
            <div class="tips box">
              <div class="icon icon-invoice-tips"></div>
              <div class="tc-666 box-f1">
                长途交通费包括机票/火车票/自驾/轮船等
              </div>
            </div>
          </div>
          <div class="item box box-ver">
            <div>市内交通</div>
            <div class="box box-ac amount">
              <div>¥&nbsp;</div>
              <input v-auto-scroll class="box-f1" v-limit-money v-model="person.TAXIEXPENSE" type="number">
            </div>
            <div class="tips box">
              <div class="icon icon-invoice-tips"></div>
              <div class="tc-666 box-f1">
                出差地内因公产生的打车费、公共交通费用等
              </div>
            </div>
          </div>
        </div>
      </div>
      <div @click="sure()" class="btn-bot">确定</div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'caiBaoFeeJiaoTong',
  data () {
    return {
      billIndex: '',
      personIndex: '',
      person: {
        TAXIEXPENSE: '',
        BUSSESEXPENSE: '',
        CFGOBACKFLY: ''
      }
    }
  },
  computed: {
    ...mapState(['bizAccountBill']),
    total () {
      let TAXIEXPENSE = this.person.TAXIEXPENSE || 0
      let BUSSESEXPENSE = this.person.BUSSESEXPENSE || 0
      let CFGOBACKFLY = this.person.CFGOBACKFLY || 0
      let total = (+TAXIEXPENSE) + (+BUSSESEXPENSE) + (+CFGOBACKFLY)
      return total.toFixed(2)
    }
  },
  created () {
    this.billIndex = this.$route.query.billIndex
    this.personIndex = this.$route.query.personIndex
    let person = this.bizAccountBill.marchInfos[this.billIndex].travelPerson[this.personIndex]
    this.person = Object.assign({}, this.person, person)
  },
  mounted () {
  },
  methods: {
    sure () {
      this.person.jtTotal = this.total
      this.bizAccountBill.marchInfos[this.billIndex].travelPerson[this.personIndex] = this.person
      this.$store.commit('bizAccountBill', {
        marchInfos: this.bizAccountBill.marchInfos
      })
      this.$router.go(-1)
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../assets/css/caiBaoFee';
.btn-bot{
  position: relative;
}
</style>
